import pandas as pd

jsl_df = pd.read_csv("E:\\MarketData\\Timer_Data\\akshare_bond_convert_jsl.csv", encoding="GBK")
jsl_df["bond_id"] = jsl_df["bond_id"].astype(str)
jsl_df["exchange"] = jsl_df["stock_id"].str.slice(0,2).str.upper()
print(jsl_df["exchange"])

jsl_df["stock_id"] = jsl_df["stock_id"].str.slice(2)
jsl_df["stock_id"]= jsl_df["stock_id"].str.cat(jsl_df["exchange"], sep=".")
print(jsl_df["stock_id"])

jsl_df["bond_id"] = jsl_df["bond_id"].str.cat(jsl_df["exchange"], sep=".")
print(jsl_df["bond_id"])

jsl_df.set_index("bond_id", inplace=True)
jsl_df = jsl_df[["stock_id", "bond_nm", "stock_nm"]]
jsl_dict = jsl_df.to_dict("index")
for k, v in jsl_dict.items():
    print(k, v)

jsl_list = jsl_df.to_list()
for j in jsl_list:
    print(j)
